<?php

/**
 * @author Marc André Audet <root@manhim.net>
 * @copyright Copyright(c) 2009-2010 Marc André Audet
 * @version 2.0.5.23
 * @license http://www.gnu.org/licenses/gpl.txt The GNU General Public License version 3
 *
 *   Manhim's Object Oriented framework
 *   Version consist of:
 *   [Major Version].[Number of years since 2010].[Month].[Date]
 *   The informations are based on the latest edit of this file, not the whole project.
 *
 *   Copyright (C) 2009-2010 Marc André Audet
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

if (!defined('IN_MANHIM_FRAMEWORK')) exit();

/*	This is a class used by the Framework_Modules.abstract abstract
 class. It is a required abstract class for the whole framework
 to work correctly. It also requires the constant
 MODULES_CLASS_PREFIX to be defined. */
class Framework_Modules_List
{
	private $_Args = array();
	private $_Modules = array();

	public function __construct($args)
	{
		$this->_Args = $args;
	}

	public function AddModule($name)
	{
		$this->_Modules['' . $name . ''] = void;
	}

	public function __get($member)
	{
		if (isset($this->_Modules['' . $member . '']) && $this->_Modules['' . $member . ''] !== void)
		{
			return $this->_Modules['' . $member . ''];
		}
		else if (isset($this->_Modules['' . $member . '']))
		{
			$name = MODULES_CLASS_PREFIX . $member;
			$this->_Modules['' . $member . ''] = new $name;
			$this->_Modules['' . $member . '']->SetArgs($this->_Args);
			$this->_Modules['' . $member . '']->SetModules($this);
			return $this->_Modules['' . $member . ''];
		}
		else
		{
			return null;
		}
	}

	public function __set($member, $value)
	{
		return null;
	}
}

?>